package net.aiion.weave.impl.messaging;

import net.aiion.weave.spi.messaging.MessageResult;

public class MessageResultImpl implements MessageResult
{
    private final Object receiver;
    private final Object message;
    private final Object result;
    private final Throwable cause;

    public MessageResultImpl(final Object aReceiver, final Object aMessage, final Object aResult) {
        receiver = aReceiver;
        message = aMessage;
        result = aResult;
        cause = null;
    }

    public MessageResultImpl(final Object aReceiver, final Object aMessage, final Throwable aCause) {
        receiver = aReceiver;
        message = aMessage;
        result = null;
        cause = aCause;
    }

    @Override
    public Object getReceiver() {
        return receiver;
    }

    @Override
    public Object getMessage() {
        return message;
    }

    @Override
    public Object getResult() {
        return result;
    }

    @Override
    public Throwable getCause() {
        return cause;
    }
}
